﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EnglishAuction.BUS
{
    public class LoaiNhanVienBUS
    {
        public static List<LoaiNhanVien> GetAll()
        {
            using (var context = new EnglishAuctionEntities())
            {
                return context.LoaiNhanViens.ToList();
            }
        }

        public static LoaiNhanVien Get(int id)
        {
            using (var context = new EnglishAuctionEntities())
            {
                return context.LoaiNhanViens.Where(p => p.Id == id).FirstOrDefault();
            }
        }

        public static bool CheckUsername(string taikhoan)
        {
            using (var context = new EnglishAuctionEntities())
            {
                var result = context.NhanViens.Where(p => p.TaiKhoan.Equals(taikhoan.Trim()));
                if(result != null && result.Count() > 0)
                    return true;
                return false;
            }
        }
    }
}